package com.hzdl.flower.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzdl.flower.bean.Admin;
import com.hzdl.flower.mapper.AdminMapper;
import com.hzdl.flower.service.AdminService;
import com.hzdl.flower.vo.AdminVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminMapper am;

    @Override
    public PageInfo<Admin> findAdmin(AdminVo adminVo) {
        PageHelper.startPage(adminVo.getPage(), adminVo.getLimit());
        List<Admin> roleList = am.findAdmin(adminVo);
        PageInfo pageInfo = new PageInfo(roleList);
        return pageInfo;
    }

    @Override
    public int addAdmin(AdminVo adminVo) {
        return am.addAdmin(adminVo);
    }

    @Override
    public int deleteById(String id) {
        return am.deleteById(id);
    }

    @Override
    public int updateAdmin(AdminVo adminVo) {
        return am.updateAdmin(adminVo);
    }

    @Override
    public Admin findById(String id) {
        return findById(id);
    }


}
